public class Property extends Object implements XMLMarshallable
Java class represents a custom property (string, number, or date) in a chargeable item.ChargeableItemThe XML APIs specify the following XSD fragment:
XSD Fragment
<xs:simpleType name="propertyType">
<xs:restriction base="xs:string">
<xs:enumeration value="string"/>
<xs:enumeration value="number"/>
<xs:enumeration value="date"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="p">
<xs:complexType>
<xs:attribute name="t" type="propertyType"/>
<xs:attribute name="v" type="xs:string"/>
<xs:attribute name="n" type="xs:string"/>
</xs:complexType>
</xs:element>
| Type | Property and Description |
|---|---|
ComponentProperty |
toComponent
Converts the
Property to a ComponentProperty. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DATE
Constant for the
date Property type. |
static int |
DATE_REF
Constant for the
+100 date Property type. |
static int |
NUMBER
Constant for the
number Property type. |
static int |
NUMBER_REF
Constant for the
+100 number Property type. |
static int |
STRING
Constant for the
string Property type. |
static int |
STRING_REF
Constant for the
+100 string Property type. |
| Constructor and Description |
|---|
Property()
Builds an empty property.
|
Property(String name,
int type,
Object value)
Builds a chargeable item property.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCharacterData(String cData)
Adds character data to the content element.
|
void |
addChild(String tagName,
XMLMarshallable child)
Adds a child to the object, the
child representing
the marshallable object which must be added to the element. |
Property |
duplicate()
Returns a new clone instance of the property
|
String |
getName()
Returns the name of the custom property.
|
int |
getType()
Returns the type of the custom property.
|
Object |
getValue()
Returns the value of the property.
|
void |
marshal(XMLOutputter output)
Gives an XML representation of this object, including its children.
|
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setName(String name)
Sets the name of the custom property.
|
void |
setType(int type)
Sets the type of the property.
|
void |
setValue(Object val)
Sets the value of the property.
|
ComponentProperty |
toComponentProperty()
Converts the
Property to a ComponentProperty. |
public ComponentProperty toComponentProperty
Property to a ComponentProperty.public static final int NUMBER
number Property type.public static final int STRING
string Property type.public static final int DATE
date Property type.public static final int NUMBER_REF
+100 number Property type.public static final int STRING_REF
+100 string Property type.public static final int DATE_REF
+100 date Property type.public Property()
public Property(String name, int type, Object value)
name - The name of the property (must be
unique for a given hargeableItem).
This name must be the same as the
name which is declared into the
associated PropertyDescriptionModel object.type - The type of the property.
This type must be the same as the type
which is declared into the
associated PropertyDescriptionModel object.value - The value of the property.
This value must be compatible with the
declared type.STRING,
NUMBER,
DATE,
STRING_REF,
NUMBER_REF,
DATE_REFpublic String getName()
public void setName(String name)
name - The name of the property of a chargeable itempublic int getType()
STRING,
NUMBER,
DATE,
STRING_REF,
NUMBER_REF,
DATE_REFpublic void setType(int type)
type - The type of the propertypublic Object getValue()
java.math.BigDecimal
for a NUMBER type.java.util.Date
for a DATE type.java.lang.String
for a STRING type.STRING,
NUMBER,
DATE,
STRING_REF,
NUMBER_REF,
DATE_REFpublic void setValue(Object val)
val - The value of the propertygetValue(),
STRING,
NUMBER,
DATE,
STRING_REF,
NUMBER_REF,
DATE_REFpublic Property duplicate()
public void addCharacterData(String cData)
XMLMarshallableaddCharacterData in interface XMLMarshallablecData - The character data to be addedpublic void setAttributes(XMLAttributes atts)
XMLMarshallablesetAttributes in interface XMLMarshallableatts - The XML attributes of the current elementpublic ComponentProperty toComponentProperty()
Property to a ComponentProperty.public void addChild(String tagName, XMLMarshallable child)
XMLMarshallablechild representing
the marshallable object which must be added to the element.addChild in interface XMLMarshallabletagName - The name of tag for the childchild - The child to be addedpublic void marshal(XMLOutputter output)
XMLMarshallablemarshal in interface XMLMarshallableoutput - The XML output to marshal the object into